<template>
	<view class="body">
		
		<view style="height: 1rpx;"></view>
		
		
		<view class="headbox">
			<view class="headbox1" @tap="getstatus" data-i="-1"  :class="[icons==-1?'icons':'']" > 全部</view>
			<view class="headbox1" @tap="getstatus" data-i="0" :class="[icons==0?'icons':'']">待审核</view>
			<view class="headbox1" @tap="getstatus" data-i="1" :class="[icons==1?'icons':'']">已审核</view>
		</view>
		
		<view class="orderbox" v-for="item in list">
			
			<view class="orderboxhe">
				<view class="orderboxhe1"> {{item.timestamp}} </view>
				<view class="orderboxhe2">  {{item.status==1?'已审核':'待审核'}} </view>
			</view>
			
			<view class="orderinfo">
				<image class="orderinfo_img" mode="aspectFill" src="@/static/icon.png" ></image>
				<view  class="orderinfo_more">
					<view class="orderinfo_more1"> {{item.gname}} </view>
					<view class="orderinfo_more2">
						<view class="orderinfo_more2l"> ¥{{item.money}} </view>
						<view class="orderinfo_more2r"> *{{item.number}} </view>
					</view>
					
					<view class="orderinfo_more3">
						用户信息: {{item.bname}} {{item.mobile}}
					</view>
					<view class="orderinfo_more3">
						地址: {{item.address}} {{item.mobile}}
					</view>
					<view class="orderinfo_more3">
						客户名称: {{item.uname}}
					</view>
				</view>
			</view>
			
			<view class="order_money">
				 100(实付) 1000(原价)
			</view>
			
			<view class="order_fotr">
				
				<view class="order_fotr1" v-if="item.status!=1" :data-id="item.id"  @tap="quxiaoorder" > 取消订单 </view>
				<view class="order_fotr2" :data-id="item.id" v-if="item.status=='0'&&item.btypes=='a'" @tap="successorder">通过审核</view>
			</view>
			
		</view>
		
		<view style="height: 120rpx;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				icons:-1
			}
		},
		
		onShow() {
			
			this.getorderlist();
			
		},
		
		methods: {
		
			getstatus(ret){
				var i=ret.currentTarget.dataset.i;
				console.log()
				this.icons=i;
				this.getorderlist();
			},
	
			
			getorderlist(){
				var that=this;
				var i=this.icons;
				
				that.list=[];
				this.$u.api.getProductLists3({i:i}).then(res => {
					console.log(res)
					that.list=res.data
				})
			},
			quxiaoorder(ret){
				
				console.log(ret);
				//	productLists5
				
				var id=ret.currentTarget.dataset.id;
				var that=this;
				uni.showModal({
					title:'温馨提示',
					content:'确认要取消订单?',
					success:function(res){
						if (res.confirm) {
							that.$u.api.getProductLists5({id:id}).then(res => {
								console.log(res)
								that.getorderlist();
							})
						}
					}
				})
			},
			successorder(ret){
				var id=ret.currentTarget.dataset.id;
				var that=this;
				uni.showModal({
					title:'温馨提示',
					content:'确认通过审核?',
					success:function(res){
						if (res.confirm) {
							that.$u.api.getProductLists7({id:id}).then(res => {
								console.log(res)
								that.getorderlist();
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
	.icons::before{
		content: '';
		width: 60rpx;height: 4rpx;
		background: #75cf80;
		position: absolute;
		bottom: -5px;right: 50%;margin-right: -30rpx;
	}
	.icons{
		color: #76d081;position: relative;
	}
	.headbox1{
		width: 120rpx;text-align: center;font-size: 32rpx;font-weight: 500;
	}
	.headbox{
		width: 710rpx;height: 90rpx;margin: auto;
		display: flex;align-items: center;
	}
	
	.orderinfo_more3{
		font-size: 28rpx;color: #666666;line-height: 45rpx;
	}
	.order_fotr2{
		width: 160rpx;height: 60rpx;
		border-radius: 50rpx;border: 1px solid #75cf80;
		text-align: center;line-height: 60rpx;background-color: #75cf80;
		color: #ffffff;margin-left: 20rpx;
	}
	.order_fotr1{
		width: 160rpx;height: 60rpx;
		border-radius: 50rpx;border: 1px solid #75cf80;
		text-align: center;line-height: 60rpx;color: #75cf80;
	}
	.order_fotr{
		width: 670rpx;height: 90rpx;margin: auto;
		display: flex;align-items: center;justify-content: flex-end;
	}
	.order_money{
		width: 670rpx;height: 50rpx;margin: auto;
		text-align: right;font-size: 28rpx;font-weight: 500;
	}
	.orderinfo_more2r{
		font-size: 28rpx;font-weight: 500;color: #666666;
	}
	.orderinfo_more2l{
		font-size: 30rpx;font-weight: bold;
	}
	.orderinfo_more2{
		width: 510rpx;height: 50rpx;
		display: flex;align-items: center;justify-content: space-between;
	}
	.orderinfo_more1{
		height: 90rpx;font-size: 30rpx;font-weight: 500;
	}
	.orderinfo_more{
		width: 510rpx;margin-left: 15rpx;height: auto;
	}
	.orderinfo_img{
		width: 140rpx;height: 140rpx;border-radius: 10rpx;
	}
	.orderinfo{
		width: 670rpx;height: auto;margin: auto;
		display: flex;justify-content: space-between;

	}
	
	.orderboxhe2{
		font-size: 30rpx;color: #76d081;font-weight: 500;
	}
	.orderboxhe1{
		font-size: 28rpx;color: #666666;
	}
	
	.orderboxhe{
		width: 670rpx;height: 70rpx;margin: auto;
		display: flex;align-items: center;
		justify-content: space-between;
	}
	
	.orderbox{
		width: 710rpx;height: auto;margin: auto;
		margin-top: 20rpx;border-radius: 20rpx;
		box-shadow:0px 0px 8px 0px rgba(50, 50, 50, 0.275);
	}
	
	.body{
		width: 100%;min-height: 100vh;
		background: #fdfdfd;
	}
</style>
